package com.sicheng.蓝桥.省赛.十三届;

import java.util.Arrays;

/**
 * @author zsc
 * @version 1.0
 * @date 2022/4/26 11:24
 */
public class 阶乘中0的个数 {

    public static void main(String[] args) {
//        Scanner scanner = new Scanner(System.in);
//        long k = scanner.nextLong();
    }

    private static void arrDp(long k) {
        //dp[i] 表示(5*i)!
        //只有出现才会有0
        // (1*5)! =1*2*...*5  才会出现0
        // (2*5)! =1*2*...*10
        long[] dp = new long[10000000];
        dp[1] = 1;
        for (int i = 2; i < 10000000; i++) {
            dp[i] += dp[i - 1] + count(i);
        }
        long i = Arrays.binarySearch(dp, k);
        System.out.println(i * 5);
    }

    private static long count(long i) {
        if (i <= 4)
            return 1;
        int count = 0;
        while (i / 5 * 5 == i) {
            i /= 5;
            count++;
        }
        return count + 1;
    }
    static void solution(long k) {
        // k 出现的0的个数
        long dp = 1;
        long i = 2;
        for (; i < 9_00_000_000L; i++) {
            dp = dp + count(i);
            if (k == dp)
                break;
        }
        System.out.println(i * 5);
    }
}
